#include "Point3f.h"


Point3f::Point3f(void)
{
	x = 0;
	y = 0;
	z = 0;
}
Point3f::Point3f(float nx, float ny, float nz)
{
	x = nx;
	y = ny;
	z = nz;
}

Point3f::~Point3f(void)
{
}

Point3f Point3f::operator+(Point3f& p)
{
	return Point3f(x + p.x, y + p.y, z + p.z);
}
void Point3f::operator+=(Point3f& p)
{
	x += p.x;
	y += p.y;
	z += p.z;
}
Point3f Point3f::operator-(Point3f& p)
{
	return Point3f(x - p.x, y - p.y, z - p.z);
}
void Point3f::operator-=(Point3f& p)
{
	x -= p.x;
	y -= p.y;
	z -= p.z;
}
Point3f Point3f::operator*(float f)
{
	return Point3f(x * f, y * f, z * f);
}
void Point3f::operator*=(float f)
{
	x *= f;
	y *= f;
	z *= f;
}

float Point3f::distanceSqr(Point3f& p)
{
	float xd = x - p.x;
	float yd = y - p.y;
	float zd = z - p.z;
	return xd * xd + yd * yd + zd * zd;
}